import 'dart:async';
import 'dart:developer';

import 'baidu_trace_platform_interface.dart';
import 'call_back.dart';

class BaiduTrace {
  void setListener() {
    BaiduTracePlatform.instance.setTraceListener();
  }

  Stream<BaiduListener> getStream(){
    return BaiduTracePlatform.instance.getStream();
  }

  Future<String?> getPlatformVersion() {
    return BaiduTracePlatform.instance.getPlatformVersion();
  }

  Future<bool?> initSdk(Map<String,dynamic> args) {
    return BaiduTracePlatform.instance.initSdk(args);
  }

  Future<bool?> addEntity(int tag, int serviceId, String entityName,
      {String? entityDesc, Map<String, String>? columns}) {
    log('addEntity----$tag');
    return BaiduTracePlatform.instance.addEntity(tag, serviceId, entityName,
        entityDesc: entityDesc, columns: columns);
  }

  Future<bool?> updateEntity(int tag, int serviceId, String entityName,
      {String? entityDesc, Map<String, String>? columns}) {
    return BaiduTracePlatform.instance.updateEntity(tag, serviceId, entityName,
        entityDesc: entityDesc, columns: columns);
  }

  Future<bool?> startTrace(int serviceId, String entityName) {
    return BaiduTracePlatform.instance.startTrace(serviceId, entityName);
  }

  Future<bool?> stopTrace(int serviceId, String entityName) {
    return BaiduTracePlatform.instance.stopTrace(serviceId, entityName);
  }

  Future<bool?> startGather() {
    return BaiduTracePlatform.instance.startGather();
  }

  Future<bool?> stopGather() {
    return BaiduTracePlatform.instance.stopGather();
  }
}
